﻿<Window x:Class="CCRPlanner.CCRPlannerMain"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:CCRPlanner"
    Title="Code Camp Room Planner" WindowState="Maximized" >
    <Window.Resources>
        <Style TargetType="Button">
            <Setter Property="Margin" Value="1"/>
        </Style>
        <DataTemplate DataType="{x:Type local:Room}" x:Name="RoomTemplate">
            <DockPanel PreviewMouseLeftButtonUp="Room_PreviewMouseLeftButtonUp" Tag="{Binding}" Margin="3">
                <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                    <Label Content="{Binding RoomName}" />
                    <Label Content="{Binding TimeAvail}" />
                    <Label Content="{Binding Conflicts}" />
                </StackPanel>
                <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
                    <Button Content="↑" Tag="UP"/>
                    <Button Content="↓" Tag="DOWN"/>
                    <Button Content="Conflicts" Tag="CONFLICT"/>
                    <Button Content="Add" Tag="ADD"/>
                    <Button Content="Remove" Tag="REMOVE"/>
                </StackPanel>
                <ListView x:Name="lvSessions" ItemsSource="{Binding Sessions}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                    <ListView.ItemTemplate>
                        <DataTemplate DataType="SessionStats">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="18"/>
                                    <ColumnDefinition Width="18"/>
                                    <ColumnDefinition Width="18"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Text="{Binding Voters.Length}"/>
                                <TextBlock Grid.Column="1" Text="{Binding Conflicts}"/>
                                <TextBlock Grid.Column="2" Text="{Binding BlockLength}"/>
                                <TextBlock Grid.Column="3" Text="{Binding Display}" TextWrapping="Wrap"/>
                            </Grid>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </DockPanel>
        </DataTemplate>
    </Window.Resources>
    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
            <Label x:Name="lConflicts" Content="" />
            <Button x:Name="bSaveData" Content="Save" Click="bSaveData_Click" />
            <Button x:Name="bLoadData" Content="Load" Click="bLoadData_Click" />
            <Button x:Name="bExport" Content="Export" Click="bExport_Click" />
        </StackPanel>

        <Grid x:Name="gRooms" />

    </Grid>
</Window>
